#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QCommonStyle>
#include <QWidget>
#include <QPushButton>
#include <QToolButton>
#include <QCheckBox>
#include <QLineEdit>
#include <QSpinBox>
#include <QListWidget>
#include <QProgressBar>
#include <QRadioButton>
#include <QScrollBar>
#include <QComboBox>
#include <QSlider>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QMenu>
#include <QPalette>
#include <QColor>
#include <QHeaderView>
#include <QCompleter>
#include <QLabel>
#include <QFileDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QDebug>
#include <QGraphicsDropShadowEffect>
#include <QGSettings>
#include <QStackedWidget>
#include <QDialogButtonBox>
#include <QTextEdit>
#include <QButtonGroup>
#include <KWindowEffects>
#include <QPrinter>
#include <QPrintDialog>
#include <QScreen>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //init menu for check mode
    mainwindowMenu = new QMenu();
    mainwindowMenu->setObjectName("xibowenshengrikuaile");
    QList<QAction *> actions;
    QAction *action1 = new QAction("nihao111111111111");
    QAction *action2 = new QAction("nihao2");
    QAction *action3 = new QAction("nihao3");

    action1->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action2->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action3->setIcon(QIcon::fromTheme("edit-delete-symbolic"));

    action1->setShortcut(QKeySequence("Ctrl+M"));
    action3->setEnabled(false);


    mainwindowMenu2 = new QMenu(mainwindowMenu);//绑定父子类关系
    QList<QAction *> actions2;
    QAction *action21 = new QAction("nihao1");
    QAction *action22 = new QAction("nihao2");
    QAction *action23 = new QAction("nihao3");

    action21->setCheckable(true);
    action22->setCheckable(true);
    action23->setCheckable(true);

    action21->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action22->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action23->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    actions2<<action21;
    actions2<<action22;
    actions2<<action23;
    mainwindowMenu2->addActions(actions2);
    action2->setMenu(mainwindowMenu2);

    actions<<action1;
    actions<<action2;
    actions<<action3;
    mainwindowMenu->addActions(actions);

    mainwindowMenu->setProperty("needTranslucent",false);
    mainwindowMenu2->setProperty("needTranslucent",false);
}

MainWindow::~MainWindow()
{
    delete ui;
}



//QPushButotn
void MainWindow::on_pushButton_clicked()
{
    QWidget *wid = new QWidget();
//    wid->setAttribute(Qt::WA_TranslucentBackground);
    // wid->setAutoFillBackground(true);


    QGridLayout *layout = new QGridLayout;
    wid->setProperty("isWindowButton",0x02);

    QLabel *la1 = new QLabel;
    la1->setText("普通按钮");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QPushButton *button1 = new QPushButton;
    button1->setText("普通状态");
    button1->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button1->setToolTip("testtest");

    QPushButton *button2 = new QPushButton;
    button2->setText("禁用状态");
    button2->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button2->setDisabled(true);

    QPushButton *button3 = new QPushButton;
    button3->setText("菜单按钮");
    button3->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button3->setProperty("useButtonPalette", true);

    QMenu *menu1 = new QMenu(wid);
    QList<QAction *> actions1;
    QAction *action11 = new QAction("nihao1");
    QAction *action12 = new QAction("nihao2");
    QAction *action13 = new QAction("nihao3");

    action11->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action12->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action13->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    actions1<<action11;
    actions1<<action12;
    actions1<<action13;

    action11->setCheckable(true);
    action12->setCheckable(true);
    action13->setCheckable(true);
    menu1->addActions(actions1);

    button3->setMenu(menu1);

    QLabel *la2 = new QLabel;
    la2->setText("高亮按钮");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QPushButton *button4 = new QPushButton;
    button4->setText("普通状态");
    button4->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button4->setToolTip("testtest");
    button4->setProperty("isImportant",true);

    QPushButton *button5 = new QPushButton;
    button5->setText("禁用状态");
    button5->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button5->setDisabled(true);
    button5->setProperty("isImportant",true);
    // qDebug() << "getDisable button5 widget = " << button5;



    button1->setProperty("needTranslucent",false);
    button2->setProperty("needTranslucent",false);
    button3->setProperty("needTranslucent",false);
    button4->setProperty("needTranslucent",false);
    button5->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(button1, 1, 0);
    layout->addWidget(button2, 1, 1);
    layout->addWidget(button3, 1, 2);
    layout->addWidget(la2, 2, 0);
    layout->addWidget(button4, 3, 0);
    layout->addWidget(button5, 3, 1);

    wid->setAttribute(Qt::WA_DeleteOnClose, true);
    wid->setLayout(layout);
    wid->show();
}

//QToolButton
void MainWindow::on_pushButton_18_clicked()
{
    QWidget *wid = new QWidget();
    QVBoxLayout *layout = new QVBoxLayout;
    QHBoxLayout *layout1 = new QHBoxLayout;
    QHBoxLayout *layout2 = new QHBoxLayout;
    QHBoxLayout *layout3 = new QHBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通按钮");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QToolButton *button1 = new QToolButton;
    button1->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button1->setToolTip("testtest");

    QToolButton *button2 = new QToolButton;
    button2->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button2->setDisabled(true);

    QToolButton *button3 = new QToolButton;
    button3->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button3->setProperty("useButtonPalette", true);

    QToolButton *button3_tmp = new QToolButton;
    // button3_tmp->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button3_tmp->setArrowType(Qt::LeftArrow);


    QMenu *menu1 = new QMenu(wid);
    QList<QAction *> actions1;
    QAction *action11 = new QAction("nihao1");
    QAction *action12 = new QAction("nihao2");
    QAction *action13 = new QAction("nihao3");

    action11->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action12->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action13->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    actions1<<action11;
    actions1<<action12;
    actions1<<action13;

    action11->setCheckable(true);
    action12->setCheckable(true);
    action13->setCheckable(true);
    menu1->addActions(actions1);

    button3->setMenu(menu1);
    button3->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式


    QToolButton *buttonc = new QToolButton;
    buttonc->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    buttonc->setProperty("useButtonPalette", true);
    buttonc->setDisabled(true);
    buttonc->setMenu(menu1);
    buttonc->setPopupMode(QToolButton::MenuButtonPopup);
    QLabel *la2 = new QLabel;
    la2->setText("高亮按钮");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QToolButton *button4 = new QToolButton;
    button4->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button4->setToolTip("testtest");
    button4->setProperty("isImportant",true);

    QToolButton *button5 = new QToolButton;
    button5->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button5->setDisabled(true);
    button5->setProperty("isImportant",true);

    QToolButton *buttona = new QToolButton;
    buttona->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    buttona->setDisabled(true);
    buttona->setProperty("isImportant",true);
    buttona->setMenu(menu1);
    buttona->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式
    QToolButton *buttone = new QToolButton;
    buttone->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    // buttone->setDisabled(true);
    buttone->setProperty("isImportant",true);
    buttone->setMenu(menu1);
    buttone->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式

    QLabel *la3 = new QLabel;
    la3->setText("无底色按钮");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QToolButton *button6 = new QToolButton;
    button6->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button6->setToolTip("testtest");
    button6->setAutoRaise(true);

    QToolButton *button7 = new QToolButton;
    button7->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button7->setDisabled(true);
    button7->setAutoRaise(true);
    QToolButton *button8 = new QToolButton;
    button8->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    // button8->setDisabled(true);
    button8->setAutoRaise(true);
    button8->setMenu(menu1);
    button8->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式
    QToolButton *buttond = new QToolButton;
    buttond->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    buttond->setDisabled(true);
    buttond->setAutoRaise(true);
    buttond->setMenu(menu1);
    buttond->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式

    button1->setProperty("needTranslucent",false);
    button2->setProperty("needTranslucent",false);
    button3->setProperty("needTranslucent",false);
    button4->setProperty("needTranslucent",false);
    button5->setProperty("needTranslucent",false);
    button6->setProperty("needTranslucent",false);
    button7->setProperty("needTranslucent",false);
button8->setProperty("needTranslucent",false);
    // 设置水平布局为左对齐
    layout1->setAlignment(Qt::AlignLeft);
    layout2->setAlignment(Qt::AlignLeft);
    layout3->setAlignment(Qt::AlignLeft);

    // 设置垂直布局的对齐方式（可选）
    layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);

    // 设置布局的边距
    layout->setContentsMargins(10, 10, 10, 10);
    layout1->setContentsMargins(0, 0, 0, 0);
    layout2->setContentsMargins(0, 0, 0, 0);
    layout3->setContentsMargins(0, 0, 0, 0);

    layout1->addWidget(button1);
    layout1->addWidget(button2);
    layout1->addWidget(button3);
    layout1->addWidget(button3_tmp);
    layout1->addWidget(buttonc);
    layout2->addWidget(button4);
    layout2->addWidget(button5);
layout2->addWidget(buttone);
    layout2->addWidget(buttona);
    layout3->addWidget(button6);
    layout3->addWidget(button7);
    layout3->addWidget(button8);
    layout3->addWidget(buttond);
    layout->addWidget(la1);
    layout->addLayout(layout1);
    layout->addWidget(la2);
    layout->addLayout(layout2);
    layout->addWidget(la3);
    layout->addLayout(layout3);

    wid->setAttribute(Qt::WA_DeleteOnClose, true);
    wid->setLayout(layout);
    wid->show();
}

//QCheckbox
void MainWindow::on_pushButton_2_clicked()
{
    QWidget *wid = new QWidget;
    QGridLayout *layout = new QGridLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QCheckBox *checkbox1 = new QCheckBox;
    checkbox1->setText("checkbox1");

    QCheckBox *checkbox2 = new QCheckBox;
    checkbox2->setText("checkbox3");
    checkbox2->setTristate(true);

    QLabel *la2 = new QLabel;
    la2->setText("禁用状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QCheckBox *checkbox3 = new QCheckBox;
    checkbox3->setText("checkbox3");
    checkbox3->setDisabled(true);

    QCheckBox *checkbox4 = new QCheckBox;
    checkbox4->setText("checkbox4");
    checkbox4->setTristate(true);
    checkbox4->setChecked(true);
    checkbox4->setDisabled(true);


    QCheckBox *checkbox5 = new QCheckBox;
    checkbox5->setText("checkbox5");
    checkbox5->setTristate(true);
    checkbox5->setChecked(true);
    checkbox5->setDisabled(true);
    checkbox5->setCheckState(Qt::PartiallyChecked);  // 设置为中间态

    checkbox1->setProperty("needTranslucent",false);
    checkbox2->setProperty("needTranslucent",false);
    checkbox3->setProperty("needTranslucent",false);
    checkbox4->setProperty("needTranslucent",false);
    checkbox5->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(checkbox1, 1, 0);
    layout->addWidget(checkbox2, 1, 1);
    layout->addWidget(la2, 2, 0);
    layout->addWidget(checkbox3, 3, 0);
    layout->addWidget(checkbox4, 3, 1);
    layout->addWidget(checkbox5, 3, 2);

    wid->setLayout(layout);
    wid->show();
}


//radio
void MainWindow::on_pushButton_6_clicked()
{
    QWidget *wid = new QWidget;
    QGridLayout *layout = new QGridLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QRadioButton *radio1 = new QRadioButton;
    radio1->setText("radio1");

    QRadioButton *radio2 = new QRadioButton;
    radio2->setText("radio2"); // 修正原代码中的文字错误

    QLabel *la2 = new QLabel;
    la2->setText("禁用状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QRadioButton *radio3 = new QRadioButton;
    radio3->setText("radio3");
    radio3->setDisabled(true);

    QRadioButton *radio4 = new QRadioButton;
    radio4->setText("radio4");
    radio4->setDisabled(true);
    radio4->setChecked(true);

    // 创建两个按钮组
    QButtonGroup *group1 = new QButtonGroup(wid);
    QButtonGroup *group2 = new QButtonGroup(wid);

    // 将radio1和radio2添加到第一组
    group1->addButton(radio1);
    group1->addButton(radio2);

    // 将radio3和radio4添加到第二组
    group2->addButton(radio3);
    group2->addButton(radio4);

    radio1->setProperty("needTranslucent",false);
    radio2->setProperty("needTranslucent",false);
    radio3->setProperty("needTranslucent",false);
    radio4->setProperty("needTranslucent",false);

    // 设置布局
    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(radio1, 1, 0);
    layout->addWidget(radio2, 1, 1);
    layout->addWidget(la2, 2, 0);
    layout->addWidget(radio3, 3, 0);
    layout->addWidget(radio4, 3, 1);

    wid->setLayout(layout);
    wid->show();
}

//QLineEdit
void MainWindow::on_pushButton_19_clicked()
{
    QWidget *wid = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QLineEdit *lineedit1 = new QLineEdit;
    lineedit1->setText("输入内容");
    lineedit1->setClearButtonEnabled(true);
    QAction *ai = new QAction(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic"),"nihao", lineedit1);
    lineedit1->addAction(ai, QLineEdit::LeadingPosition);

    QStringList country;
    country<<"China"<<"Japan"<<"English"<<"Endian"<<"American"<<"Australia";
    QCompleter *completer = new QCompleter(country, this);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    lineedit1->setCompleter(completer);


    QLineEdit *lineedit2 = new QLineEdit;
    lineedit2->setPlaceholderText("输入内容");

    QLabel *la2 = new QLabel;
    la2->setText("密码框");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    //QT原始的QLineEdit无法设置小眼睛图标，并设置是否明文还是密文
    QLineEdit *lineedit3 = new QLineEdit;
    lineedit3->setPlaceholderText("输入密码");
    lineedit3->setEchoMode(QLineEdit::Password);

    QLabel *la3 = new QLabel;
    la3->setText("disable状态");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QLineEdit *lineedit4 = new QLineEdit;
    lineedit4->setText("输入内容");
    lineedit4->setDisabled(true);

    lineedit1->setProperty("needTranslucent",false);
    lineedit2->setProperty("needTranslucent",false);
    lineedit3->setProperty("needTranslucent",false);
    lineedit4->setProperty("needTranslucent",false);

    lineedit1->setClearButtonEnabled(true);
    lineedit2->setClearButtonEnabled(true);
    lineedit3->setClearButtonEnabled(true);

    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(lineedit1);
    layout->addWidget(lineedit2);
    layout->addWidget(la2);
    layout->addWidget(lineedit3);
    layout->addWidget(la3);
    layout->addWidget(lineedit4);

    wid->setLayout(layout);
    wid->show();
}

//QSpinBox
void MainWindow::on_pushButton_3_clicked()
{
    QWidget *wid = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSpinBox *spinbox1 = new QSpinBox;
    QSpinBox *spinbox2 = new QSpinBox;

    QLabel *la2 = new QLabel;
    la2->setText("禁用状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSpinBox *spinbox3 = new QSpinBox;
    spinbox3->setValue(10);
    spinbox3->setDisabled(true);

    spinbox1->setProperty("needTranslucent",false);
    spinbox2->setProperty("needTranslucent",false);
    spinbox3->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(spinbox1);
    layout->addWidget(spinbox2);
    layout->addWidget(la2);
    layout->addWidget(spinbox3);

    wid->setLayout(layout);
    wid->show();
}



//listview
void MainWindow::on_pushButton_4_clicked()
{
    QWidget *wid = new QWidget;
    QGridLayout *layout = new QGridLayout;


    QLabel *la1 = new QLabel;
    la1->setText("高亮状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QListWidget *list1 = new QListWidget;
    list1->addItem("test1");
    list1->addItem("test2");
    list1->addItem("test3");
    list1->addItem("test4");
    list1->addItem("test5");
    list1->addItem("test6");
    list1->addItem("test7");
    list1->addItem("test8");
    list1->item(2)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    list1->item(5)->setFlags(list1->item(5)->flags() & ~Qt::ItemIsEnabled);
    list1->item(0)->setCheckState(Qt::Checked);
    list1->setAlternatingRowColors(true);
    list1->setSelectionMode(QAbstractItemView::ContiguousSelection);
    list1->setProperty("useIconHighlightEffect", 0x2);
    list1->setProperty("highlightMode", true);



    QLabel *la2 = new QLabel;
    la2->setText("普通状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QListWidget *list2 = new QListWidget;
    list2->addItem("test1");
    list2->addItem("test2");
    list2->addItem("test3");
    list2->addItem("test4");
    list2->addItem("test5");
    list2->addItem("test6");
    list2->addItem("test7");
    list2->addItem("test8");
    list2->item(0)->setCheckState(Qt::Checked);
    list2->item(1)->setToolTip("worinidaye");
    list2->item(3)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    list2->item(5)->setFlags(list2->item(5)->flags() & ~Qt::ItemIsEnabled);
    list2->setSelectionMode(QAbstractItemView::ContiguousSelection);
    // list2->setProperty("highlightMode",true);

    list2->setAlternatingRowColors(true);


    list1->setProperty("needTranslucent",false);



    list2->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(la2, 0, 1);
    layout->addWidget(list1, 1, 0);
    layout->addWidget(list2, 1, 1);

    wid->setLayout(layout);
    wid->show();
}


//progress
void MainWindow::on_pushButton_5_clicked()
{
    QWidget *wid = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通进度条");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QProgressBar *progress1 = new QProgressBar;
    progress1->setValue(20);

    QProgressBar *progress2 = new QProgressBar;
    progress2->setValue(50);

    QProgressBar *progress3 = new QProgressBar;
    progress3->setValue(80);

    QLabel *la2 = new QLabel;
    la2->setText("循环进度条");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QProgressBar *progress4 = new QProgressBar;
    progress4->setMaximum(0);
    progress4->setMinimum(0);

    progress1->setProperty("needTranslucent",false);
    progress2->setProperty("needTranslucent",false);
    progress3->setProperty("needTranslucent",false);
    progress4->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(progress1);
    layout->addWidget(progress2);
    layout->addWidget(progress3);
    layout->addWidget(la2);
    layout->addWidget(progress4);

    wid->setLayout(layout);
    wid->show();
}


//scroller
void MainWindow::on_pushButton_7_clicked()
{
    QWidget *wid = new QWidget;
    wid->setFixedSize(300,600);

    QVBoxLayout *layout = new QVBoxLayout;
    QVBoxLayout *layout1 = new QVBoxLayout;
    QHBoxLayout *layout2 = new QHBoxLayout;
    QVBoxLayout *layout3 = new QVBoxLayout;
    QHBoxLayout *layout4 = new QHBoxLayout;


    QLabel *la1 = new QLabel;
    la1->setText("横向滚动条");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QScrollBar *scrollbar1 = new QScrollBar(Qt::Horizontal);
    scrollbar1->setMinimum(0);
    scrollbar1->setMaximum(100);
    scrollbar1->setValue(20);

    QScrollBar *scrollbar2 = new QScrollBar(Qt::Horizontal);
    scrollbar2->setDisabled(true);
    scrollbar2->setMinimum(0);
    scrollbar2->setMaximum(100);
    scrollbar2->setValue(40);

    QLabel *la2 = new QLabel;
    la2->setText("纵向滚动条");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QScrollBar *scrollbar3 = new QScrollBar(Qt::Vertical);
    scrollbar3->setMinimum(0);
    scrollbar3->setMaximum(100);
    scrollbar3->setValue(60);

    QScrollBar *scrollbar4 = new QScrollBar(Qt::Vertical);
    scrollbar4->setDisabled(true);
    scrollbar4->setMinimum(0);
    scrollbar4->setMaximum(100);
    scrollbar4->setValue(80);

    scrollbar1->setProperty("needTranslucent",false);
    scrollbar2->setProperty("needTranslucent",false);
    scrollbar3->setProperty("needTranslucent",false);
    scrollbar4->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout1->addWidget(la1);
    layout1->addWidget(scrollbar1);
    layout1->addWidget(scrollbar2);
    layout1->addWidget(la2);
    layout2->addWidget(scrollbar3);
    layout2->addWidget(scrollbar4);


    QLabel *la3 = new QLabel;
    la3->setText("两端箭头");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);


    QLabel* la4 = new QLabel("   横向");
    la4->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QLabel* la5 = new QLabel("   纵向");
    la5->setTextInteractionFlags(Qt::TextSelectableByMouse);


    QScrollBar* bararrow1 = new QScrollBar(Qt::Horizontal);
    QScrollBar* bararrow2 = new QScrollBar(Qt::Horizontal);
    bararrow2->setDisabled(true);
    bararrow1->setMinimum(0);
    bararrow1->setMaximum(100);
    bararrow1->setValue(16);
    bararrow2->setMinimum(0);
    bararrow2->setMaximum(100);
    bararrow2->setValue(50);


    QScrollBar* bararrow3 = new QScrollBar(Qt::Vertical);
    QScrollBar* bararrow4 = new QScrollBar(Qt::Vertical);
    bararrow4->setDisabled(true);

    bararrow3->setMinimum(0);
    bararrow3->setMaximum(100);
    bararrow3->setValue(10);
    bararrow4->setMinimum(0);
    bararrow4->setMaximum(100);
    bararrow4->setValue(50);

    bararrow1->setProperty("needTranslucent",false);
    bararrow2->setProperty("needTranslucent",false);
    bararrow3->setProperty("needTranslucent",false);
    bararrow4->setProperty("needTranslucent",false);

    bararrow1->setProperty("needArrow",true);
    bararrow2->setProperty("needArrow",true);
    bararrow3->setProperty("needArrow",true);
    bararrow4->setProperty("needArrow",true);


    layout3->addWidget(la3);
    layout3->addWidget(la4);
    layout3->addWidget(bararrow1);
    layout3->addWidget(bararrow2);
    layout3->addSpacing(20);
    layout3->addWidget(la5);


    layout4->addWidget(bararrow3);
    layout4->addWidget(bararrow4);


    layout->addLayout(layout1);
    layout->addLayout(layout2);
    layout->addLayout(layout3);
    layout->addLayout(layout4);


    wid->setLayout(layout);
    wid->setAttribute(Qt::WA_DeleteOnClose, true);

    wid->show();
}


//slider
void MainWindow::on_pushButton_9_clicked()
{

    QWidget *wid = new QWidget;

    QVBoxLayout *layout = new QVBoxLayout;
    QVBoxLayout *layout1 = new QVBoxLayout;
    QHBoxLayout *layout2 = new QHBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("横向滑动条");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSlider *slider1 = new QSlider(Qt::Horizontal);

    QSlider *slider2 = new QSlider(Qt::Horizontal);
    slider2->setTickPosition(QSlider::TicksBothSides);
    slider2->setMaximum(10);
    slider2->setMinimum(0);
    slider2->setSingleStep(1);
    slider2->setPageStep(1);

    QSlider *slider3 = new QSlider(Qt::Horizontal);
    slider3->setDisabled(true);

    QLabel *la2 = new QLabel;
    la2->setText("纵向滑动条");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSlider *slider4 = new QSlider(Qt::Vertical);

    QSlider *slider5 = new QSlider(Qt::Vertical);
    slider5->setTickPosition(QSlider::TicksBothSides);
    slider5->setMaximum(10);
    slider5->setMinimum(0);
    slider5->setSingleStep(1);
    slider5->setPageStep(1);

    QSlider *slider6 = new QSlider(Qt::Vertical);
    slider6->setDisabled(true);


    slider1->setProperty("needTranslucent",false);
    slider2->setProperty("needTranslucent",false);
    slider3->setProperty("needTranslucent",false);
    slider4->setProperty("needTranslucent",false);
    slider5->setProperty("needTranslucent",false);
    slider6->setProperty("needTranslucent",false);


    layout->setSpacing(10);
    layout1->addWidget(la1);
    layout1->addWidget(slider1);
    layout1->addWidget(slider2);
    layout1->addWidget(slider3);
    layout1->addWidget(la2);
    layout2->addWidget(slider4);
    layout2->addWidget(slider5);
    layout2->addWidget(slider6);
    layout->addLayout(layout1);
    layout->addLayout(layout2);

    wid->setLayout(layout);
    wid->show();
}

//QComboBox
void MainWindow::on_pushButton_8_clicked()
{
    QWidget *wid = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QComboBox *combobox1 = new QComboBox;
    int i;
    for (i = 0; i < 50; i++) {
        combobox1->addItem(tr("item %1").arg(i));
    }
    combobox1->setMaxVisibleItems(10);


    QLabel *la1_1 = new QLabel;
    la1_1->setText("添加分割线");
    la1_1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QComboBox *combobox1_1 = new QComboBox;
    for (int j = 0; j < 50; j++) {
        combobox1_1->addItem(tr("item %1").arg(j));
    }
    combobox1_1->setMaxVisibleItems(10);

    //insertSeparator
    int cnt = combobox1_1->count();
    for(int s=cnt-5;s>=0;s-=5) {
        combobox1_1->insertSeparator(s);
    }

    QLabel *la2 = new QLabel;
    la2->setText("可编辑状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QComboBox *combobox2 = new QComboBox;
    combobox2->addItem("item1");
    combobox2->addItem("item2");
    combobox2->addItem("item333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333124121251512312312333333333333333333333333333333333333333333");
    combobox2->addItem("item4");
    combobox2->addItem("item5");
    combobox2->addItem("item6");
    combobox2->addItem("item7");
    combobox2->addItem("item8");
    combobox2->setItemIcon(2, QIcon::fromTheme("edit-delete-symbolic"));
    combobox2->setToolTip(combobox2->itemText(0));
    combobox2->setEditable(true);
    combobox2->setMaximumWidth(200);

    QLabel *la3 = new QLabel;
    la3->setText("disable状态");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QComboBox *combobox3 = new QComboBox;
    combobox3->addItem("item1");
    combobox3->addItem("item2");
    combobox3->setDisabled(true);

    combobox1->setProperty("needTranslucent",false);
    combobox2->setProperty("needTranslucent",false);
    combobox3->setProperty("needTranslucent",false);


    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(combobox1);
    layout->addWidget(la1_1);
    layout->addWidget(combobox1_1);
    layout->addWidget(la2);
    layout->addWidget(combobox2);
    layout->addWidget(la3);
    layout->addWidget(combobox3);

    wid->setLayout(layout);
    wid->setAttribute(Qt::WA_DeleteOnClose, true);

    wid->show();
}


//table
void MainWindow::on_pushButton_10_clicked()
{
    QWidget *wid = new QWidget;
    QHBoxLayout *layout = new QHBoxLayout(wid);
    layout->setSpacing(20); // 两个表格之间的间距

    // 创建第一个表格
    QTableWidget *table1 = new QTableWidget(4, 4);
    for(int i = 0; i < 4; i++)
        for(int j = 0; j < 4; j++) {
            if (j == 0) {
                table1->setItem(i, j, new QTableWidgetItem("输入文本"));
                table1->item(i, j)->setToolTip("tooltip");
                table1->item(i, j)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
            } else {
                table1->setItem(i, j, new QTableWidgetItem("内容\n内容"));
            }
            table1->item(i, j)->setTextAlignment(Qt::AlignCenter);
        }
    // 第一个表格的配置
    table1->setSortingEnabled(true);
    table1->setSelectionMode(QAbstractItemView::SingleSelection);
    table1->verticalHeader()->setVisible(true);
    table1->setAlternatingRowColors(true);
    table1->setShowGrid(false);
    for(int i = 0; i < 4; i++) {
        table1->item(i, 0)->setCheckState(Qt::Checked);
    }
    for(int i = 0; i < 4; i++) {
        table1->item(2, i)->setFlags(table1->item(3, i)->flags() & ~Qt::ItemIsEnabled);
    }
    table1->setProperty("needTranslucent",false);

    // 创建第二个完全相同的表格
    QTableWidget *table2 = new QTableWidget(4, 4);
    for(int i = 0; i < 4; i++)
        for(int j = 0; j < 4; j++) {
            if (j == 0) {
                table2->setItem(i, j, new QTableWidgetItem("输入文本"));
                table2->item(i, j)->setToolTip("tooltip");
                table2->item(i, j)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
            } else {
                table2->setItem(i, j, new QTableWidgetItem("内容\n内容"));
            }
            table2->item(i, j)->setTextAlignment(Qt::AlignCenter);
        }
    // 第二个表格的配置（与第一个完全相同）
    table2->setSortingEnabled(true);
    // table2->setSelectionMode(QAbstractItemView::SingleSelection);
    table2->setSelectionBehavior(QAbstractItemView::SelectRows);
    table2->verticalHeader()->setVisible(true);
    table2->setAlternatingRowColors(true);
    table2->setShowGrid(false);
    for(int i = 0; i < 4; i++) {
        table2->item(i, 0)->setCheckState(Qt::Checked);
    }
    for(int i = 0; i < 4; i++) {
        table2->item(2, i)->setFlags(table2->item(3, i)->flags() & ~Qt::ItemIsEnabled);
    }
    table2->setProperty("needTranslucent",false);

    // 将两个表格添加到布局
    layout->addWidget(table1);
    layout->addWidget(table2);

    wid->setLayout(layout);
    wid->resize(1000, 400); // 调整窗口大小以容纳两个表格
    wid->show();
}


//tabs
void MainWindow::on_pushButton_11_clicked()
{

    QWidget *wid = new QWidget;
    // wid->setAttribute(Qt::WA_TranslucentBackground);
    QHBoxLayout *layout = new QHBoxLayout;

    QTabWidget *tab1 = new QTabWidget;
    QWidget *tab1_test1 = new QWidget(tab1);
    QWidget *tab1_test2 = new QWidget(tab1);
    QWidget *tab1_test3 = new QWidget(tab1);
    QWidget *tab1_test4 = new QWidget(tab1);
    QVBoxLayout  *tab1_layout = new QVBoxLayout;
    QPushButton *tab1_button1 = new QPushButton("111111");
    QPushButton *tab1_button2 = new QPushButton("222222");
    QPushButton *tab1_button3 = new QPushButton("333333");
    QPushButton *tab1_button4 = new QPushButton("444444");
    // QBrush bbl;
    // bbl = QBrush(Qt::red);
    tab1->tabBar()->setProperty("needTranslucent" , false);
    // tab1_test1->setProperty("needTranslucent" , false);
    // tab1_test2->setProperty("needTranslucent" , false);
    // tab1_test3->setProperty("needTranslucent" , false);
    // tab1_test4->setProperty("needTranslucent" , false);
    // // tab1->setProperty("setTabBarHoverBrush",bbl);
    tab1_layout->setSpacing(10);
    tab1_layout->addWidget(tab1_button1);
    tab1_layout->addWidget(tab1_button2);
    tab1_layout->addWidget(tab1_button3);
    tab1_layout->addWidget(tab1_button4);
    tab1_test2->setLayout(tab1_layout);
    tab1->addTab(tab1_test1, QIcon::fromTheme("edit-delete-symbolic"), "test1111111111111111111111111111111111111111qweqqeqwewqeqwe");
    tab1->addTab(tab1_test2, QIcon::fromTheme("edit-delete-symbolic"), "test2");
    tab1->addTab(tab1_test3, QIcon::fromTheme("edit-delete-symbolic"), "test3");
    tab1->addTab(tab1_test4, QIcon::fromTheme("edit-delete-symbolic"), "test4");
    tab1->setMovable(true);
    tab1->setTabsClosable(true);
    //tab1->tabBar()->setElideMode(Qt::ElideRight);//tabbar文字省略
    //tab1->tabBar()->setDrawBase(true);
    //tab1->tabBar()->setUsesScrollButtons(false);
    //tab1->tabBar()->setExpanding(true);

    // tab1->setProperty("needTranslucent",false);
    tab1->setProperty("needTranslucent",false);
    tab1->tabBar()->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout->addWidget(tab1);

    wid->setLayout(layout);
    wid->show();
}


//tree
void MainWindow::on_pushButton_12_clicked()
{
    QWidget *wid = new QWidget;
// wid->setAttribute(Qt::WA_TranslucentBackground);
    QHBoxLayout *layout = new QHBoxLayout;

    QTreeWidget *tree1 = new QTreeWidget(wid);

    QTreeWidgetItem *tree1_1 = new QTreeWidgetItem(tree1);
    QTreeWidgetItem *tree1_2 = new QTreeWidgetItem(tree1);
    QTreeWidgetItem *tree1_1_1 = new QTreeWidgetItem(tree1_1);
    QTreeWidgetItem *tree1_1_2 = new QTreeWidgetItem(tree1_1);
    QTreeWidgetItem *tree1_2_1 = new QTreeWidgetItem(tree1_2);
    QTreeWidgetItem *tree1_2_2 = new QTreeWidgetItem(tree1_2);
    QTreeWidgetItem *tree1_1_1_1 = new QTreeWidgetItem(tree1_1_1);
    QTreeWidgetItem *tree1_1_1_2 = new QTreeWidgetItem(tree1_1_1);
    QTreeWidgetItem *tree1_1_2_1 = new QTreeWidgetItem(tree1_1_2);
    QTreeWidgetItem *tree1_1_2_2 = new QTreeWidgetItem(tree1_1_2);
    QTreeWidgetItem *tree1_2_1_1 = new QTreeWidgetItem(tree1_2_1);
    QTreeWidgetItem *tree1_2_1_2 = new QTreeWidgetItem(tree1_2_1);
    QTreeWidgetItem *tree1_2_2_1 = new QTreeWidgetItem(tree1_2_2);
    QTreeWidgetItem *tree1_2_2_2 = new QTreeWidgetItem(tree1_2_2);
    tree1_1->setText(0, "tree1");
    tree1_2->setText(0, "tree2");
    tree1_1->setText(1, "tree1");
    tree1_2->setText(1, "tree2");
    tree1_1->setText(2, "tree1");
    tree1_2->setText(2, "tree2");
    tree1_1->setText(3, "tree1");
    tree1_2->setText(3, "tree2");
    tree1_1->setText(4, "tree1");
    tree1_2->setText(4, "tree2");

    tree1_1_1->setText(0, "tree1-1");
    tree1_1_2->setText(0, "tree1-2");
    tree1_2_1->setText(0, "tree2-1");
    tree1_2_2->setText(0, "tree2-2");
    tree1_1_1_1->setText(0, "tree1-1-1");
    tree1_1_1_2->setText(0, "tree1-1-2");

    tree1_1_2_1->setText(0, "tree1-2-1");
    tree1_1_2_1->setIcon(0,QIcon::fromTheme("org.gnome.Mines"));

    tree1_1_2_2->setText(0, "tree1-2-2");
    tree1_2_1_1->setText(0, "tree2-1-1");
    tree1_2_1_2->setText(0, "tree2-1-2");
    tree1_2_2_1->setText(0, "tree2-2-11111");
    tree1_2_2_1->setDisabled(false);
    tree1_2_2_2->setText(0, "tree2-2-22222");
    tree1_2_2_2->setDisabled(false);
    tree1_2_2_2->setToolTip(0, "hello the fucking world");

// //    tree1->setHeaderHidden(true);//隐藏表头
//     tree1->setColumnCount(8);//设置列数
//    tree1->setRootIsDecorated(false);//top branch
//    // tree1->expandAll();//展开全部
//    tree1->setAlternatingRowColors(true);//
//     tree1->setHeaderLabel("tree");
//    tree1->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
//    tree1->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
//     tree1_2_2_1->setDisabled(true);
//     tree1->setAnimated(true);//动画
//    tree1->setRootIsDecorated(false);

//     tree1->setProperty("highlightMode", true);
//     tree1->verticalScrollBar()->setProperty("drawScrollBarGroove", false);/*
//     // tree1->setDragEnabled(true);
//     // tree1->setDragDropMode(QAbstractItemView::InternalMove);//item移动*/

    //    tree1->setHeaderHidden(true);//隐藏表头
    tree1->setColumnCount(8);//设置列数
       tree1->setRootIsDecorated(false);//top branch
       tree1->expandAll();//展开全部
    tree1->setAlternatingRowColors(true);//
    tree1->setHeaderLabel("tree");
    //    tree1->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    //    tree1->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    tree1_2_2_1->setDisabled(true);
    tree1->setAnimated(true);//动画
    //    tree1->setRootIsDecorated(false);

    tree1->setProperty("highlightMode", true);
    tree1->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
    tree1->setDragEnabled(true);
    tree1->setDragDropMode(QAbstractItemView::InternalMove);//item移动


    QTreeWidget *tree2 = new QTreeWidget(wid);
    QTreeWidgetItem *tree2_1 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_2 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_3 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_4 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_5 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_6 = new QTreeWidgetItem(tree2);
    tree2->setAlternatingRowColors(true);//斑马线
    tree2->setHeaderLabel("tree");
    tree2_1->setText(0, "tree1");
    tree2_2->setText(0, "tree2");
    tree2_3->setText(0, "tree3");
    tree2_4->setText(0, "tree4");
    tree2_5->setText(0, "tree5");
    tree2_6->setText(0, "tree6");

    tree2->setRootIsDecorated(false);
    tree2->setSelectionMode(QAbstractItemView::ContiguousSelection);
    tree2_6->setToolTip(0, "hello the fucking world2");
        // tree2->setProperty("highlightMode", true);
    tree1->setSelectionMode(QAbstractItemView::ContiguousSelection);

    tree1->setProperty("needTranslucent",false);
    tree2->setProperty("needTranslucent",false);

    layout->setSpacing(10);
    layout->addWidget(tree1);
    layout->addWidget(tree2);


    wid->setLayout(layout);
    wid->show();
}


//右键菜单
void MainWindow::on_pushButton_13_clicked()
{
    mainwindowMenu->move(600, 400);
//    mainwindowMenu->move(1600, 400); 子菜单位于主菜单左侧的特殊情况
    mainwindowMenu->show();
}

//pushbutton translucent
void MainWindow::on_pushButton_31_clicked()
{
    QWidget *wid = new QWidget();
    QGridLayout *layout = new QGridLayout;
    wid->setAttribute(Qt::WA_TranslucentBackground);

    QLabel *la1 = new QLabel;
    la1->setText("普通按钮");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QPushButton *button1 = new QPushButton;
    button1->setText("普通状态");
    button1->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button1->setToolTip("testtest");

    QPushButton *button2 = new QPushButton;
    button2->setText("禁用状态");
    button2->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button2->setDisabled(true);

    QPushButton *button3 = new QPushButton;
    button3->setText("菜单按钮");
    button3->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button3->setProperty("useButtonPalette", true);

    QMenu *menu1 = new QMenu(wid);
    QList<QAction *> actions1;
    QAction *action11 = new QAction("nihao1");
    QAction *action12 = new QAction("nihao2");
    QAction *action13 = new QAction("nihao3");

    action11->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action12->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action13->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    actions1<<action11;
    actions1<<action12;
    actions1<<action13;

    action11->setCheckable(true);
    action12->setCheckable(true);
    action13->setCheckable(true);
    menu1->addActions(actions1);

    button3->setMenu(menu1);

    QLabel *la2 = new QLabel;
    la2->setText("高亮按钮");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QPushButton *button4 = new QPushButton;
    button4->setText("普通状态");
    button4->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button4->setToolTip("testtest");
    button4->setProperty("isImportant",true);

    QPushButton *button5 = new QPushButton;
    button5->setText("禁用状态");
    button5->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button5->setDisabled(true);
    button5->setProperty("isImportant",true);

    button1->setProperty("needTranslucent",true);
    button2->setProperty("needTranslucent",true);
    button3->setProperty("needTranslucent",true);
    button4->setProperty("needTranslucent",true);
    button5->setProperty("needTranslucent",true);

    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(button1, 1, 0);
    layout->addWidget(button2, 1, 1);
    layout->addWidget(button3, 1, 2);
    layout->addWidget(la2, 2, 0);
    layout->addWidget(button4, 3, 0);
    layout->addWidget(button5, 3, 1);

    wid->setAttribute(Qt::WA_DeleteOnClose, true);
    wid->setLayout(layout);
    wid->show();
}

//toolbutton translucent
void MainWindow::on_pushButton_28_clicked()
{
    QWidget *wid = new QWidget();
    wid->setAttribute(Qt::WA_TranslucentBackground);

    QVBoxLayout *layout = new QVBoxLayout;
    QHBoxLayout *layout1 = new QHBoxLayout;
    QHBoxLayout *layout2 = new QHBoxLayout;
    QHBoxLayout *layout3 = new QHBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通按钮");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QToolButton *button1 = new QToolButton;
    button1->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button1->setToolTip("testtest");

    QToolButton *button2 = new QToolButton;
    button2->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button2->setDisabled(true);

    QToolButton *button3 = new QToolButton;
    button3->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button3->setProperty("useButtonPalette", true);

    QToolButton *button3_tmp = new QToolButton;
    // button3_tmp->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button3_tmp->setArrowType(Qt::LeftArrow);


    QMenu *menu1 = new QMenu(wid);
    QList<QAction *> actions1;
    QAction *action11 = new QAction("nihao1");
    QAction *action12 = new QAction("nihao2");
    QAction *action13 = new QAction("nihao3");

    action11->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action12->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    action13->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    actions1<<action11;
    actions1<<action12;
    actions1<<action13;

    action11->setCheckable(true);
    action12->setCheckable(true);
    action13->setCheckable(true);
    menu1->addActions(actions1);

    button3->setMenu(menu1);
    button3->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式


    QToolButton *buttonc = new QToolButton;
    buttonc->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    buttonc->setProperty("useButtonPalette", true);
    buttonc->setDisabled(true);
    buttonc->setMenu(menu1);
    buttonc->setPopupMode(QToolButton::MenuButtonPopup);
    QLabel *la2 = new QLabel;
    la2->setText("高亮按钮");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QToolButton *button4 = new QToolButton;
    button4->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button4->setToolTip("testtest");
    button4->setProperty("isImportant",true);

    QToolButton *button5 = new QToolButton;
    button5->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button5->setDisabled(true);
    button5->setProperty("isImportant",true);

    QToolButton *buttona = new QToolButton;
    buttona->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    buttona->setDisabled(true);
    buttona->setProperty("isImportant",true);
    buttona->setMenu(menu1);
    buttona->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式
    QToolButton *buttone = new QToolButton;
    buttone->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    // buttone->setDisabled(true);
    buttone->setProperty("isImportant",true);
    buttone->setMenu(menu1);
    buttone->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式

    QLabel *la3 = new QLabel;
    la3->setText("无底色按钮");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QToolButton *button6 = new QToolButton;
    button6->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button6->setToolTip("testtest");
    button6->setAutoRaise(true);

    QToolButton *button7 = new QToolButton;
    button7->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    button7->setDisabled(true);
    button7->setAutoRaise(true);
    QToolButton *button8 = new QToolButton;
    button8->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    // button8->setDisabled(true);
    button8->setAutoRaise(true);
    button8->setMenu(menu1);
    button8->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式
    QToolButton *buttond = new QToolButton;
    buttond->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    buttond->setDisabled(true);
    buttond->setAutoRaise(true);
    buttond->setMenu(menu1);
    buttond->setPopupMode(QToolButton::MenuButtonPopup); // 设置菜单弹出模式

    button1->setProperty("needTranslucent",true);
    button2->setProperty("needTranslucent",true);
    button3->setProperty("needTranslucent",true);
    button4->setProperty("needTranslucent",true);
    button5->setProperty("needTranslucent",true);
    button6->setProperty("needTranslucent",true);
    button7->setProperty("needTranslucent",true);
    button8->setProperty("needTranslucent",true);
    // 设置水平布局为左对齐
    layout1->setAlignment(Qt::AlignLeft);
    layout2->setAlignment(Qt::AlignLeft);
    layout3->setAlignment(Qt::AlignLeft);

    // 设置垂直布局的对齐方式（可选）
    layout->setAlignment(Qt::AlignTop | Qt::AlignLeft);

    // 设置布局的边距
    layout->setContentsMargins(10, 10, 10, 10);
    layout1->setContentsMargins(0, 0, 0, 0);
    layout2->setContentsMargins(0, 0, 0, 0);
    layout3->setContentsMargins(0, 0, 0, 0);

    layout1->addWidget(button1);
    layout1->addWidget(button2);
    layout1->addWidget(button3);
    layout1->addWidget(button3_tmp);
    layout1->addWidget(buttonc);
    layout2->addWidget(button4);
    layout2->addWidget(button5);
    layout2->addWidget(buttone);
    layout2->addWidget(buttona);
    layout3->addWidget(button6);
    layout3->addWidget(button7);
    layout3->addWidget(button8);
    layout3->addWidget(buttond);
    layout->addWidget(la1);
    layout->addLayout(layout1);
    layout->addWidget(la2);
    layout->addLayout(layout2);
    layout->addWidget(la3);
    layout->addLayout(layout3);

    wid->setAttribute(Qt::WA_DeleteOnClose, true);
    wid->setLayout(layout);
    wid->show();
}

//checkbox translucent
void MainWindow::on_pushButton_21_clicked()
{
    QWidget *wid = new QWidget;
    QGridLayout *layout = new QGridLayout;
    wid->setAttribute(Qt::WA_TranslucentBackground);

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QCheckBox *checkbox1 = new QCheckBox;
    checkbox1->setText("checkbox1");

    QCheckBox *checkbox2 = new QCheckBox;
    checkbox2->setText("checkbox3");
    checkbox2->setTristate(true);

    QLabel *la2 = new QLabel;
    la2->setText("禁用状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QCheckBox *checkbox3 = new QCheckBox;
    checkbox3->setText("checkbox3");
    checkbox3->setDisabled(true);

    QCheckBox *checkbox4 = new QCheckBox;
    checkbox4->setText("checkbox4");
    checkbox4->setTristate(true);
    checkbox4->setChecked(true);
    checkbox4->setDisabled(true);


    QCheckBox *checkbox5 = new QCheckBox;
    checkbox5->setText("checkbox5");
    checkbox5->setTristate(true);
    checkbox5->setChecked(true);
    checkbox5->setDisabled(true);
    checkbox5->setCheckState(Qt::PartiallyChecked);  // 设置为中间态

    checkbox1->setProperty("needTranslucent",true);
    checkbox2->setProperty("needTranslucent",true);
    checkbox3->setProperty("needTranslucent",true);
    checkbox4->setProperty("needTranslucent",true);
    checkbox5->setProperty("needTranslucent",true);

    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(checkbox1, 1, 0);
    layout->addWidget(checkbox2, 1, 1);
    layout->addWidget(la2, 2, 0);
    layout->addWidget(checkbox3, 3, 0);
    layout->addWidget(checkbox4, 3, 1);
    layout->addWidget(checkbox5, 3, 2);

    wid->setLayout(layout);
    wid->show();
}

//radio translucent
void MainWindow::on_pushButton_27_clicked()
{
    QWidget *wid = new QWidget;
    QGridLayout *layout = new QGridLayout;
    wid->setAttribute(Qt::WA_TranslucentBackground);

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QRadioButton *radio1 = new QRadioButton;
    radio1->setText("radio1");

    QRadioButton *radio2 = new QRadioButton;
    radio2->setText("radio2"); // 修正原代码中的文字错误

    QLabel *la2 = new QLabel;
    la2->setText("禁用状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QRadioButton *radio3 = new QRadioButton;
    radio3->setText("radio3");
    radio3->setDisabled(true);

    QRadioButton *radio4 = new QRadioButton;
    radio4->setText("radio4");
    radio4->setDisabled(true);
    radio4->setChecked(true);

    // 创建两个按钮组
    QButtonGroup *group1 = new QButtonGroup(wid);
    QButtonGroup *group2 = new QButtonGroup(wid);

    // 将radio1和radio2添加到第一组
    group1->addButton(radio1);
    group1->addButton(radio2);

    // 将radio3和radio4添加到第二组
    group2->addButton(radio3);
    group2->addButton(radio4);

    radio1->setProperty("needTranslucent",true);
    radio2->setProperty("needTranslucent",true);
    radio3->setProperty("needTranslucent",true);
    radio4->setProperty("needTranslucent",true);

    // 设置布局
    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(radio1, 1, 0);
    layout->addWidget(radio2, 1, 1);
    layout->addWidget(la2, 2, 0);
    layout->addWidget(radio3, 3, 0);
    layout->addWidget(radio4, 3, 1);

    wid->setLayout(layout);
    wid->show();
}

//listview translucent
void MainWindow::on_pushButton_26_clicked()
{
    QWidget *wid = new QWidget;
    QGridLayout *layout = new QGridLayout;
    wid->setAttribute(Qt::WA_TranslucentBackground);

    QLabel *la1 = new QLabel;
    la1->setText("高亮状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QListWidget *list1 = new QListWidget;
    list1->addItem("test1");
    list1->addItem("test2");
    list1->addItem("test3");
    list1->addItem("test4");
    list1->addItem("test5");
    list1->addItem("test6");
    list1->addItem("test7");
    list1->addItem("test8");
    list1->item(0)->setCheckState(Qt::Checked);
    list1->item(2)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    list1->item(5)->setFlags(list1->item(5)->flags() & ~Qt::ItemIsEnabled);
   list1->setAlternatingRowColors(true);
    list1->setSelectionMode(QAbstractItemView::ContiguousSelection);
    list1->setProperty("useIconHighlightEffect", 0x2);
    list1->setProperty("highlightMode", true);


    QLabel *la2 = new QLabel;
    la2->setText("普通状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QListWidget *list2 = new QListWidget;
    list2->addItem("test1");
    list2->addItem("test2");
    list2->addItem("test3");
    list2->addItem("test4");
    list2->addItem("test5");
    list2->addItem("test6");
    list2->addItem("test7");
    list2->addItem("test8");
    list2->item(0)->setCheckState(Qt::Checked);
    list2->item(1)->setToolTip("worinidaye");
    list2->item(3)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
    list2->item(5)->setFlags(list2->item(5)->flags() & ~Qt::ItemIsEnabled);
    list2->setSelectionMode(QAbstractItemView::ContiguousSelection);
    list2->setAlternatingRowColors(true);

    list1->setProperty("needTranslucent",true);
    list2->setProperty("needTranslucent",true);

    QPalette pal = qApp->palette();
    pal.setColor(QPalette::Base, QColor(Qt::transparent));
    list1->setPalette(pal);
    list2->setPalette(pal);

    layout->setSpacing(10);
    layout->addWidget(la1, 0, 0);
    layout->addWidget(la2, 0, 1);
    layout->addWidget(list1, 1, 0);
    layout->addWidget(list2, 1, 1);

    wid->setLayout(layout);
    wid->show();
}

//tableview translucent
void MainWindow::on_pushButton_20_clicked()
{
    QWidget *wid = new QWidget;
    QHBoxLayout *layout = new QHBoxLayout(wid);
    wid->setAttribute(Qt::WA_TranslucentBackground);
    layout->setSpacing(20); // 两个表格之间的间距

    // 创建第一个表格
    QTableWidget *table1 = new QTableWidget(4, 4);
    for(int i = 0; i < 4; i++)
        for(int j = 0; j < 4; j++) {
            if (j == 0) {
                table1->setItem(i, j, new QTableWidgetItem("输入文本"));
                table1->item(i, j)->setToolTip("tooltip");
                table1->item(i, j)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
            } else {
                table1->setItem(i, j, new QTableWidgetItem("内容\n内容"));
            }
            table1->item(i, j)->setTextAlignment(Qt::AlignCenter);
        }
    // 第一个表格的配置
    table1->setSortingEnabled(true);
    table1->setSelectionMode(QAbstractItemView::SingleSelection);
    // table1->setSelectionBehavior(QAbstractItemView::SelectRows);
    table1->verticalHeader()->setVisible(true);
    table1->setAlternatingRowColors(true);
    table1->setShowGrid(false);

    // 设置复选框状态
    for(int i = 0; i < 4; i++) {
        table1->item(i, 0)->setCheckState(Qt::Checked);
    }

    // 禁用第三行
    for(int i = 0; i < 4; i++) {
        table1->item(2, i)->setFlags(table1->item(3, i)->flags() & ~Qt::ItemIsEnabled);
    }

    // 设置透明属性
    table1->setProperty("needTranslucent", true);
    QPalette pal1 = qApp->palette();
    pal1.setColor(QPalette::Base, QColor(Qt::transparent));
    table1->setPalette(pal1);

    // 创建第二个完全相同的透明表格
    QTableWidget *table2 = new QTableWidget(4, 4);
    for(int i = 0; i < 4; i++)
        for(int j = 0; j < 4; j++) {
            if (j == 0) {
                table2->setItem(i, j, new QTableWidgetItem("输入文本"));
                table2->item(i, j)->setToolTip("tooltip");
                table2->item(i, j)->setIcon(QIcon::fromTheme("edit-delete-symbolic"));
            } else {
                table2->setItem(i, j, new QTableWidgetItem("内容\n内容"));
            }
            table2->item(i, j)->setTextAlignment(Qt::AlignCenter);
        }
    // 第二个表格的配置
    table2->setSortingEnabled(true);
    // table2->setSelectionMode(QAbstractItemView::SingleSelection);
    table2->setSelectionBehavior(QAbstractItemView::SelectRows);
    table2->verticalHeader()->setVisible(true);
    table2->setAlternatingRowColors(true);
    table2->setShowGrid(false);

    // 设置复选框状态
    for(int i = 0; i < 4; i++) {
        table2->item(i, 0)->setCheckState(Qt::Checked);
    }

    // 禁用第三行
    for(int i = 0; i < 4; i++) {
        table2->item(2, i)->setFlags(table2->item(3, i)->flags() & ~Qt::ItemIsEnabled);
    }

    // 设置透明属性
    table2->setProperty("needTranslucent", true);
    QPalette pal2 = qApp->palette();
    pal2.setColor(QPalette::Base, QColor(Qt::transparent));
    table2->setPalette(pal2);

    // 将两个表格添加到布局
    layout->addWidget(table1);
    layout->addWidget(table2);

    wid->setLayout(layout);
    wid->resize(1000, 400); // 调整窗口大小以容纳两个表格
    wid->show();
}


//tree translucent
void MainWindow::on_pushButton_24_clicked()
{
    QWidget *wid = new QWidget;
    wid->setAttribute(Qt::WA_TranslucentBackground);
    QHBoxLayout *layout = new QHBoxLayout;

    QTreeWidget *tree1 = new QTreeWidget(wid);
    QTreeWidgetItem *tree1_1 = new QTreeWidgetItem(tree1);
    QTreeWidgetItem *tree1_2 = new QTreeWidgetItem(tree1);
    QTreeWidgetItem *tree1_1_1 = new QTreeWidgetItem(tree1_1);
    QTreeWidgetItem *tree1_1_2 = new QTreeWidgetItem(tree1_1);
    QTreeWidgetItem *tree1_2_1 = new QTreeWidgetItem(tree1_2);
    QTreeWidgetItem *tree1_2_2 = new QTreeWidgetItem(tree1_2);
    QTreeWidgetItem *tree1_1_1_1 = new QTreeWidgetItem(tree1_1_1);
    QTreeWidgetItem *tree1_1_1_2 = new QTreeWidgetItem(tree1_1_1);
    QTreeWidgetItem *tree1_1_2_1 = new QTreeWidgetItem(tree1_1_2);
    QTreeWidgetItem *tree1_1_2_2 = new QTreeWidgetItem(tree1_1_2);
    QTreeWidgetItem *tree1_2_1_1 = new QTreeWidgetItem(tree1_2_1);
    QTreeWidgetItem *tree1_2_1_2 = new QTreeWidgetItem(tree1_2_1);
    QTreeWidgetItem *tree1_2_2_1 = new QTreeWidgetItem(tree1_2_2);
    QTreeWidgetItem *tree1_2_2_2 = new QTreeWidgetItem(tree1_2_2);
    tree1_1->setText(0, "tree1");
    tree1_2->setText(0, "tree2");
    tree1_1->setText(1, "tree1");
    tree1_2->setText(1, "tree2");
    tree1_1->setText(2, "tree1");
    tree1_2->setText(2, "tree2");
    tree1_1->setText(3, "tree1");
    tree1_2->setText(3, "tree2");
    tree1_1->setText(4, "tree1");
    tree1_2->setText(4, "tree2");

    tree1_1_1->setText(0, "tree1-1");
    tree1_1_2->setText(0, "tree1-2");
    tree1_2_1->setText(0, "tree2-1");
    tree1_2_2->setText(0, "tree2-2");
    tree1_1_1_1->setText(0, "tree1-1-1");
    tree1_1_1_2->setText(0, "tree1-1-2");

    tree1_1_2_1->setText(0, "tree1-2-1");
    tree1_1_2_1->setIcon(0,QIcon::fromTheme("org.gnome.Mines"));

    tree1_1_2_2->setText(0, "tree1-2-2");
    tree1_2_1_1->setText(0, "tree2-1-1");
    tree1_2_1_2->setText(0, "tree2-1-2");
    tree1_2_2_1->setText(0, "tree2-2-1");
    tree1_2_2_2->setText(0, "tree2-2-2");
    tree1_2_2_2->setDisabled(false);
    tree1_2_2_2->setToolTip(0, "hello the fucking world");

//    tree1->setHeaderHidden(true);//隐藏表头
    tree1->setColumnCount(8);//设置列数
//    tree1->setRootIsDecorated(false);//top branch
//    tree1->expandAll();//展开全部
   tree1->setAlternatingRowColors(true);//
    tree1->setHeaderLabel("tree");
//    tree1->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
//    tree1->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    tree1_2_2_1->setDisabled(true);
    tree1->setAnimated(true);//动画
//    tree1->setRootIsDecorated(false);
    tree1->setProperty("highlightMode", true);
    tree1->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
    tree1->setDragEnabled(true);
    tree1->setDragDropMode(QAbstractItemView::InternalMove);//item移动



    QTreeWidget *tree2 = new QTreeWidget(wid);
    QTreeWidgetItem *tree2_1 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_2 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_3 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_4 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_5 = new QTreeWidgetItem(tree2);
    QTreeWidgetItem *tree2_6 = new QTreeWidgetItem(tree2);
   tree2->setAlternatingRowColors(true);//斑马线
    tree2->setHeaderLabel("tree");
    tree2_1->setText(0, "tree1");
    tree2_2->setText(0, "tree2");
    tree2_3->setText(0, "tree3");
    tree2_4->setText(0, "tree4");
    tree2_5->setText(0, "tree5");
    tree2_6->setText(0, "tree6");

    tree2->setRootIsDecorated(false);
    tree2->setSelectionMode(QAbstractItemView::ContiguousSelection);
    tree2_6->setToolTip(0, "hello the fucking world2");
    tree1->setSelectionMode(QAbstractItemView::ContiguousSelection);

    tree1->setProperty("needTranslucent",true);
    tree2->setProperty("needTranslucent",true);

    QPalette pal = qApp->palette();
    pal.setColor(QPalette::Base, QColor(Qt::transparent));
    pal.setColor(QPalette::Window, QColor(Qt::transparent));
    tree1->setPalette(pal);
    tree2->setPalette(pal);

    layout->setSpacing(10);
    layout->addWidget(tree1);
    layout->addWidget(tree2);


    wid->setLayout(layout);
    wid->show();
}

//QCombobox translucent
void MainWindow::on_pushButton_25_clicked()
{
    QWidget *wid = new QWidget;
    wid->setAttribute(Qt::WA_TranslucentBackground);
    QVBoxLayout *layout = new QVBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QComboBox *combobox1 = new QComboBox;
    int i;
    for (i = 0; i < 50; i++) {
        combobox1->addItem(tr("item %1").arg(i));
    }
    combobox1->setMaxVisibleItems(10);


    QLabel *la1_1 = new QLabel;
    la1_1->setText("添加分割线");
    la1_1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QComboBox *combobox1_1 = new QComboBox;
    for (int j = 0; j < 50; j++) {
        combobox1_1->addItem(tr("item %1").arg(j));
    }
    combobox1_1->setMaxVisibleItems(10);

    //insertSeparator
    int cnt = combobox1_1->count();
    for(int s=cnt-5;s>=0;s-=5) {
        combobox1_1->insertSeparator(s);
    }



    QLabel *la2 = new QLabel;
    la2->setText("可编辑状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QComboBox *combobox2 = new QComboBox;
    combobox2->addItem("item1");
    combobox2->addItem("item2");
    combobox2->addItem("item333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333124121251512312312333333333333333333333333333333333333333333");
    combobox2->addItem("item4");
    combobox2->addItem("item5");
    combobox2->addItem("item6");
    combobox2->addItem("item7");
    combobox2->addItem("item8");
    combobox2->setItemIcon(2, QIcon::fromTheme("edit-delete-symbolic"));
    combobox2->setToolTip(combobox2->itemText(0));
    combobox2->setEditable(true);
    combobox2->setMaximumWidth(200);

    QLabel *la3 = new QLabel;
    la3->setText("disable状态");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QComboBox *combobox3 = new QComboBox;
    combobox3->addItem("item1");
    combobox3->addItem("item2");
    combobox3->setDisabled(true);

    combobox1->setProperty("needTranslucent",false);
    combobox2->setProperty("needTranslucent",false);
    combobox3->setProperty("needTranslucent",false);


    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(combobox1);
    layout->addWidget(la1_1);
    layout->addWidget(combobox1_1);
    layout->addWidget(la2);
    layout->addWidget(combobox2);
    layout->addWidget(la3);
    layout->addWidget(combobox3);

    wid->setLayout(layout);
    wid->setAttribute(Qt::WA_DeleteOnClose, true);

    wid->show();
}

//QLineEdit translucent
void MainWindow::on_pushButton_29_clicked()
{
    QWidget *wid = new QWidget;
    wid->setAttribute(Qt::WA_TranslucentBackground);
    QVBoxLayout *layout = new QVBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QLineEdit *lineedit1 = new QLineEdit;
    lineedit1->setText("输入内容");
    lineedit1->setClearButtonEnabled(true);
    QAction *ai = new QAction(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic"),"nihao", lineedit1);
    lineedit1->addAction(ai, QLineEdit::LeadingPosition);

    QStringList country;
    country<<"China"<<"Japan"<<"English"<<"Endian"<<"American"<<"Australia";
    QCompleter *completer = new QCompleter(country, this);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    lineedit1->setCompleter(completer);


    QLineEdit *lineedit2 = new QLineEdit;
    lineedit2->setPlaceholderText("输入内容");

    QLabel *la2 = new QLabel;
    la2->setText("密码框");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    //QT原始的QLineEdit无法设置小眼睛图标，并设置是否明文还是密文
    QLineEdit *lineedit3 = new QLineEdit;
    lineedit3->setPlaceholderText("输入密码");
    lineedit3->setEchoMode(QLineEdit::Password);

    QLabel *la3 = new QLabel;
    la3->setText("disable状态");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QLineEdit *lineedit4 = new QLineEdit;
    lineedit4->setText("输入内容");
    lineedit4->setDisabled(true);

    lineedit1->setProperty("needTranslucent",true);
    lineedit2->setProperty("needTranslucent",true);
    lineedit3->setProperty("needTranslucent",true);
    lineedit4->setProperty("needTranslucent",true);

    lineedit1->setClearButtonEnabled(true);
    lineedit2->setClearButtonEnabled(true);
    lineedit3->setClearButtonEnabled(true);

    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(lineedit1);
    layout->addWidget(lineedit2);
    layout->addWidget(la2);
    layout->addWidget(lineedit3);
    layout->addWidget(la3);
    layout->addWidget(lineedit4);

    wid->setLayout(layout);
    wid->show();
}

//Tabbar translucent
void MainWindow::on_pushButton_23_clicked()
{
    QWidget *wid = new QWidget;
    wid->setAttribute(Qt::WA_TranslucentBackground);
    QHBoxLayout *layout = new QHBoxLayout;

    QTabWidget *tab1 = new QTabWidget;
    QWidget *tab1_test1 = new QWidget(tab1);
    QWidget *tab1_test2 = new QWidget(tab1);
    QWidget *tab1_test3 = new QWidget(tab1);
    QWidget *tab1_test4 = new QWidget(tab1);
    QVBoxLayout  *tab1_layout = new QVBoxLayout;
    QPushButton *tab1_button1 = new QPushButton("111111");
    QPushButton *tab1_button2 = new QPushButton("222222");
    QPushButton *tab1_button3 = new QPushButton("333333");
    QPushButton *tab1_button4 = new QPushButton("444444");
    tab1->setAttribute(Qt::WA_TranslucentBackground);
    tab1->tabBar()->setAttribute(Qt::WA_TranslucentBackground);


    tab1_layout->setSpacing(10);
    tab1_layout->addWidget(tab1_button1);
    tab1_layout->addWidget(tab1_button2);
    tab1_layout->addWidget(tab1_button3);
    tab1_layout->addWidget(tab1_button4);
    tab1_test2->setLayout(tab1_layout);
    tab1->addTab(tab1_test1, QIcon::fromTheme("edit-delete-symbolic"), "test1111111111111111111111111111111111111111qweqqeqwewqeqwe");
    tab1->addTab(tab1_test2, QIcon::fromTheme("edit-delete-symbolic"), "test2");
    tab1->addTab(tab1_test3, QIcon::fromTheme("edit-delete-symbolic"), "test3");
    tab1->addTab(tab1_test4, QIcon::fromTheme("edit-delete-symbolic"), "test4");
    tab1->setMovable(true);
    tab1->setTabsClosable(true);
    //tab1->tabBar()->setElideMode(Qt::ElideRight);//tabbar文字省略
    //tab1->tabBar()->setDrawBase(true);
    //tab1->tabBar()->setUsesScrollButtons(false);
    //tab1->tabBar()->setExpanding(true);

    tab1->setProperty("needTranslucent",true);
    tab1->tabBar()->setProperty("needTranslucent",true);

    layout->setSpacing(10);
    layout->addWidget(tab1);

    wid->setLayout(layout);
    wid->show();
}

//progressbar translucent
void MainWindow::on_pushButton_32_clicked()
{
    QWidget *wid = new QWidget;
    wid->setAttribute(Qt::WA_TranslucentBackground);
    QVBoxLayout *layout = new QVBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("普通进度条");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QProgressBar *progress1 = new QProgressBar;
    progress1->setValue(20);

    QProgressBar *progress2 = new QProgressBar;
    progress2->setValue(50);

    QProgressBar *progress3 = new QProgressBar;
    progress3->setValue(80);

    QLabel *la2 = new QLabel;
    la2->setText("循环进度条");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QProgressBar *progress4 = new QProgressBar;
    progress4->setMaximum(0);
    progress4->setMinimum(0);

    progress1->setProperty("needTranslucent",true);
    progress2->setProperty("needTranslucent",true);
    progress3->setProperty("needTranslucent",true);
    progress4->setProperty("needTranslucent",true);

    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(progress1);
    layout->addWidget(progress2);
    layout->addWidget(progress3);
    layout->addWidget(la2);
    layout->addWidget(progress4);

    wid->setLayout(layout);
    wid->show();
}

//scroll translucent
void MainWindow::on_pushButton_33_clicked()
{
    QWidget *wid = new QWidget;
    wid->setFixedSize(300,600);
    wid->setAttribute(Qt::WA_TranslucentBackground);
    QVBoxLayout *layout = new QVBoxLayout;
    QVBoxLayout *layout1 = new QVBoxLayout;
    QHBoxLayout *layout2 = new QHBoxLayout;
    QVBoxLayout *layout3 = new QVBoxLayout;
    QHBoxLayout *layout4 = new QHBoxLayout;


    QLabel *la1 = new QLabel;
    la1->setText("横向滚动条");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QScrollBar *scrollbar1 = new QScrollBar(Qt::Horizontal);
    scrollbar1->setMinimum(0);
    scrollbar1->setMaximum(100);
    scrollbar1->setValue(20);

    QScrollBar *scrollbar2 = new QScrollBar(Qt::Horizontal);
    scrollbar2->setDisabled(true);
    scrollbar2->setMinimum(0);
    scrollbar2->setMaximum(100);
    scrollbar2->setValue(40);

    QLabel *la2 = new QLabel;
    la2->setText("纵向滚动条");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QScrollBar *scrollbar3 = new QScrollBar(Qt::Vertical);
    scrollbar3->setMinimum(0);
    scrollbar3->setMaximum(100);
    scrollbar3->setValue(60);

    QScrollBar *scrollbar4 = new QScrollBar(Qt::Vertical);
    scrollbar4->setDisabled(true);
    scrollbar4->setMinimum(0);
    scrollbar4->setMaximum(100);
    scrollbar4->setValue(80);

    scrollbar1->setProperty("needTranslucent",true);
    scrollbar2->setProperty("needTranslucent",true);
    scrollbar3->setProperty("needTranslucent",true);
    scrollbar4->setProperty("needTranslucent",true);


    layout->setSpacing(10);
    layout1->addWidget(la1);
    layout1->addWidget(scrollbar1);
    layout1->addWidget(scrollbar2);
    layout1->addWidget(la2);
    layout2->addWidget(scrollbar3);
    layout2->addWidget(scrollbar4);


    QLabel *la3 = new QLabel;
    la3->setText("两端箭头");
    la3->setTextInteractionFlags(Qt::TextSelectableByMouse);


    QLabel* la4 = new QLabel("      横向");
    la4->setTextInteractionFlags(Qt::TextSelectableByMouse);

    QLabel* la5 = new QLabel("      纵向");
    la5->setTextInteractionFlags(Qt::TextSelectableByMouse);


    QScrollBar* bararrow1 = new QScrollBar(Qt::Horizontal);
    QScrollBar* bararrow2 = new QScrollBar(Qt::Horizontal);
    bararrow2->setDisabled(true);
    bararrow1->setMinimum(0);
    bararrow1->setMaximum(100);
    bararrow1->setValue(16);
    bararrow2->setMinimum(0);
    bararrow2->setMaximum(100);
    bararrow2->setValue(50);


    QScrollBar* bararrow3 = new QScrollBar(Qt::Vertical);
    QScrollBar* bararrow4 = new QScrollBar(Qt::Vertical);
    bararrow4->setDisabled(true);

    bararrow3->setMinimum(0);
    bararrow3->setMaximum(100);
    bararrow3->setValue(10);
    bararrow4->setMinimum(0);
    bararrow4->setMaximum(100);
    bararrow4->setValue(50);

    bararrow1->setProperty("needArrow",true);
    bararrow2->setProperty("needArrow",true);
    bararrow3->setProperty("needArrow",true);
    bararrow4->setProperty("needArrow",true);


    layout3->addWidget(la3);
    layout3->addWidget(la4);
    layout3->addWidget(bararrow1);
    layout3->addWidget(bararrow2);
    layout3->setSpacing(20);
    layout3->addWidget(la5);


    layout4->addWidget(bararrow3);
    layout4->addWidget(bararrow4);

    layout->addLayout(layout1);
    layout->addLayout(layout2);
    layout->addLayout(layout3);
    layout->addLayout(layout4);

    wid->setLayout(layout);
    wid->setAttribute(Qt::WA_DeleteOnClose, true);

    wid->show();
}

//Slider
void MainWindow::on_pushButton_22_clicked()
{
    QWidget *wid = new QWidget;
    wid->setAttribute(Qt::WA_TranslucentBackground);
    QVBoxLayout *layout = new QVBoxLayout;
    QVBoxLayout *layout1 = new QVBoxLayout;
    QHBoxLayout *layout2 = new QHBoxLayout;

    QLabel *la1 = new QLabel;
    la1->setText("横向滑动条");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSlider *slider1 = new QSlider(Qt::Horizontal);

    QSlider *slider2 = new QSlider(Qt::Horizontal);
    slider2->setTickPosition(QSlider::TicksBothSides);
    slider2->setMaximum(10);
    slider2->setMinimum(0);
    slider2->setSingleStep(1);
    slider2->setPageStep(1);

    QSlider *slider3 = new QSlider(Qt::Horizontal);
    slider3->setDisabled(true);

    QLabel *la2 = new QLabel;
    la2->setText("纵向滑动条");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSlider *slider4 = new QSlider(Qt::Vertical);

    QSlider *slider5 = new QSlider(Qt::Vertical);
    slider5->setTickPosition(QSlider::TicksBothSides);
    slider5->setMaximum(10);
    slider5->setMinimum(0);
    slider5->setSingleStep(1);
    slider5->setPageStep(1);

    QSlider *slider6 = new QSlider(Qt::Vertical);
    slider6->setDisabled(true);


    slider1->setProperty("needTranslucent",true);
    slider2->setProperty("needTranslucent",true);
    slider3->setProperty("needTranslucent",true);
    slider4->setProperty("needTranslucent",true);
    slider5->setProperty("needTranslucent",true);
    slider6->setProperty("needTranslucent",true);


    layout->setSpacing(10);
    layout1->addWidget(la1);
    layout1->addWidget(slider1);
    layout1->addWidget(slider2);
    layout1->addWidget(slider3);
    layout1->addWidget(la2);
    layout2->addWidget(slider4);
    layout2->addWidget(slider5);
    layout2->addWidget(slider6);
    layout->addLayout(layout1);
    layout->addLayout(layout2);

    wid->setLayout(layout);
    wid->show();
}

//QSpinBox translucent
void MainWindow::on_pushButton_30_clicked()
{
    QFrame *wid = new QFrame;
    QVBoxLayout *layout = new QVBoxLayout;
    wid->setAttribute(Qt::WA_TranslucentBackground);

    QLabel *la1 = new QLabel;
    la1->setText("普通状态");
    la1->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSpinBox *spinbox1 = new QSpinBox;
    QSpinBox *spinbox2 = new QSpinBox;

    QLabel *la2 = new QLabel;
    la2->setText("禁用状态");
    la2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    QSpinBox *spinbox3 = new QSpinBox;
    spinbox3->setValue(10);
    spinbox3->setDisabled(true);

    spinbox1->setProperty("needTranslucent",true);
    spinbox2->setProperty("needTranslucent",true);
    spinbox3->setProperty("needTranslucent",true);

    layout->setSpacing(10);
    layout->addWidget(la1);
    layout->addWidget(spinbox1);
    layout->addWidget(spinbox2);
    layout->addWidget(la2);
    layout->addWidget(spinbox3);

    wid->setLayout(layout);
    wid->show();
}


